home *** CD-ROM | disk | FTP | other *** search
/ Sound Fx / Sound Fx.iso / Software / UNZIPED / MPW181-5 / _SETUP.1 / sublay2.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-04-19  |  3.5 KB  |  113 lines

  1. /* sublay2.cpp
  2.  
  3.    Layer II subband object declarations */
  4.  
  5.    /*
  6.  *  @(#) subband_layer_2.h 1.8, last edit: 6/15/94 16:51:59
  7.  *  @(#) Copyright (C) 1993, 1994 Tobias Bading (bading@cs.tu-berlin.de)
  8.  *  @(#) Berlin University of Technology
  9.  *
  10.  *  This program is free software; you can redistribute it and/or modify
  11.  *  it under the terms of the GNU General Public License as published by
  12.  *  the Free Software Foundation; either version 2 of the License, or
  13.  *  (at your option) any later version.
  14.  *
  15.  *  This program is distributed in the hope that it will be useful,
  16.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.  *  GNU General Public License for more details.
  19.  *
  20.  *  You should have received a copy of the GNU General Public License
  21.  *  along with this program; if not, write to the Free Software
  22.  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  23.  */
  24.  
  25. #ifndef SUBBAND_LAYER_2_H
  26. #define SUBBAND_LAYER_2_H
  27.  
  28. #include "all.h"
  29. #include "subband.h"
  30. #include "header.h"
  31. #include "crc.h"
  32.  
  33.  
  34. // class for layer II subbands in single channel mode:
  35. class SubbandLayer2 : public Subband
  36. {
  37. protected:
  38.   uint32 subbandnumber;
  39.  
  40.   uint32 allocation;
  41.   uint32 scfsi;
  42.   real     scalefactor1, scalefactor2, scalefactor3;
  43.   uint32 codelength;
  44.   const real *groupingtable;
  45.   real     factor;
  46.  
  47.   uint32 groupnumber;
  48.   uint32 samplenumber;
  49.   real     samples[3];
  50.   real     c, d;
  51.  
  52.   uint32 get_allocationlength (Header *);
  53.   void     prepare_sample_reading (Header *, uint32, const real **, real *,
  54.                  uint32 *, real *, real *);
  55.  
  56. public:
  57.         SubbandLayer2 (uint32 subbandnumber);
  58.   void        read_allocation (Ibitstream *, Header *, Crc16 *);
  59.   virtual void    read_scalefactor_selection (Ibitstream *, Crc16 *);
  60.   void        read_scalefactor (Ibitstream *, Header *);
  61.   BOOL        read_sampledata (Ibitstream *);
  62.   BOOL        put_next_sample (e_channels, SynthesisFilter *, SynthesisFilter * = NULL);
  63. };
  64.  
  65.  
  66. // class for layer II subbands in joint stereo mode:
  67. class SubbandLayer2IntensityStereo : public SubbandLayer2
  68. {
  69. protected:
  70.   uint32 channel2_scfsi;
  71.   real     channel2_scalefactor1, channel2_scalefactor2, channel2_scalefactor3;
  72.  
  73. public:
  74.        SubbandLayer2IntensityStereo (uint32 subbandnumber);
  75.   void read_allocation (Ibitstream *stream, Header *header, Crc16 *crc)
  76.   {
  77.     SubbandLayer2::read_allocation (stream, header, crc);
  78.   }
  79.   void read_scalefactor_selection (Ibitstream *, Crc16 *);
  80.   void read_scalefactor (Ibitstream *, Header *);
  81.   BOOL read_sampledata (Ibitstream *stream)
  82.   {
  83.      return SubbandLayer2::read_sampledata (stream);
  84.   }
  85.   BOOL put_next_sample (e_channels, SynthesisFilter *, SynthesisFilter *);
  86. };
  87.  
  88.  
  89. // class for layer II subbands in stereo mode:
  90. class SubbandLayer2Stereo : public SubbandLayer2
  91. {
  92. protected:
  93.   uint32 channel2_allocation;
  94.   uint32 channel2_scfsi;
  95.   real     channel2_scalefactor1, channel2_scalefactor2, channel2_scalefactor3;
  96.   BOOL     channel2_grouping;
  97.   uint32 channel2_codelength;
  98.   const real *channel2_groupingtable;
  99.   real     channel2_factor;
  100.   real     channel2_samples[3];
  101.   real     channel2_c, channel2_d;
  102.  
  103. public:
  104.        SubbandLayer2Stereo (uint32 subbandnumber);
  105.   void read_allocation (Ibitstream *, Header *, Crc16 *);
  106.   void read_scalefactor_selection (Ibitstream *, Crc16 *);
  107.   void read_scalefactor (Ibitstream *, Header *);
  108.   BOOL read_sampledata (Ibitstream *);
  109.   BOOL put_next_sample (e_channels, SynthesisFilter *, SynthesisFilter *);
  110. };
  111.  
  112. #endif
  113.